{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">地区管理</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('banner.banner/add')}"
                   data-auth-edit="{:$auth->check('banner.banner/edit')}"
                   data-auth-delete="{:$auth->check('banner.banner/del')}"></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}

<script type="text/html" id="barTool">

        <a data-open='{:url("moneydetail")}?member_id={{d.member_id }}'
           class="layui-btn layui-btn-xs layui-btn-normal"
           title="资金明细" data-full="true">资金明细</a>

    {if $userInfo['roleid']==1}
<!--    <a class="layui-btn layui-btn-xs" data-open='{:url("edit")}?id={{ d.id }}' data-title="编辑内容"-->
<!--       data-full="true">编辑</a>-->

    <a href='{:url("del",["catid"=>$catid])}?ids={{ d.id }}'
       class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del">删除</a>
    {/if}
</script>

<script type="text/html" id="picTpl">

    <img style="max-Width:80px; max-height:30px;" src="{{d.avatarUrl}}" data-image="{{d.nickname}}">

</script>

<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" data-href='{:url("setstate")}?id={{d.id}}' value="{{d.id}}"
           lay-skin="switch"
           lay-text="启动|关闭" lay-filter="switchStatus" {{ d.status==1 ? 'checked' : '' }}>
</script>

<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;
        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: '{:url("add")}',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
        };
        var proviec = {:json_encode($proviec)};
        table.render({
            init: init,
            toolbar: ['refresh'],
            // toolbar: ['refresh', 'add'],
            url: '{:url("index")}',
            search: false,
            cols: [
                [
                    //名称 水票背景图 所属商品分类 所属商品

                    {field: 'id',width: '8%', title: 'ID'},
                    { field: 'nickname', width: '12%', align: "center",title: '昵称',searchOp: 'like'},
                    { field: 'avatarUrl', width: '8%', align: "center",title: '图片', search: false, templet: '#picTpl' },
                    // {
                    //     field: 'rate', align: "center", width: '10%', title: '奖励（%）',
                    // },
                    { field: 'money', width: '8%',align: "center", title: '账户余额',search: false},
                    {
                        field: 'province',
                        align: "center",
                        width: '15%',
                        title: '省',
                        selectList: {}
                    },
                    {
                        field: 'city', align: "center", width: '15%', title: '市',
                        selectList: {}
                    },
                    {
                        field: 'area', align: "center", width: '15%', title: '区/县',
                        selectList: {}
                    },
                    { field: 'create_time',align: "center", width: '15%', title: '创建时间',search: 'range' },
                    {fixed: 'right',align: "center", width: '20%', title: '操作', toolbar: '#barTool'}
                ]
            ],
            page: {}
        });

        yznTable.bindevent();
    });
</script>
{/block}